from python_baway.exercise.io.x_files import men_list_txt_gb2312
from python_baway.common.xcommon import sep

with open(men_list_txt_gb2312, 'r', encoding='gb2312') as f:
    sep('All')
    xall = f.read()
    print(xall)

    sep('All lines')
    f.seek(0)
    xall_lines = f.readlines()
    n = 1
    for xline in xall_lines:
        print(f'{n}: {xline}')
        n += 1

    sep('Every line')
    f.seek(0)
    n = 1
    while True:
        xline = f.readline()
        if xline:
            print(f'{n}: {xline}')
            n += 1
        else:
            break
